﻿@model IEnumerable<FCNS.ERP.Models.ErpRentOrder>

@{
    ViewBag.Title = "商品租赁";
    Layout = "~/Views/Jxc/_Layout.cshtml";
}

<h2>@ViewBag.Title</h2>

<p>
    @Html.ActionLink("新增", "RentNew")
</p>

<script type="text/javascript">
    $(document).ready(function () { 
        $(".tuiZu").click(function () {
            var tr = $(this).parent().parent();
           var a=Number(tr.children("td:eq(2)").text());
           var b=Number(tr.children("td:eq(3)").text());
           alert("应退款：" + (b - a) + " 元");
           window.location.replace("RentShenHe/"+$(this).attr("data-Id"));
        }) 
    });
</script>

<table class="table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.ProductId)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Count)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Rent)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Deposit)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.OrderNO)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.DateTimeStart)
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Product.Name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Count)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Rent)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Deposit)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.OrderNO)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.DateTimeStart)
        </td>
        <td>
            <a href="RentDelete/@item.Id" class="objDelete">删除</a>

            <a href="#" class="tuiZu" data-Id=@item.Id>退租</a>
        </td>
    </tr>
}

</table>
